<%-- 
    Document   : dao4
    Created on : 2014/8/20, 下午 03:32:09
    Author     : gjun
--%>

<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<jsp:useBean class="dao.BaseDAO" id="y"/>
<%
String sql="select id,username,tel,birthday from person";
String ary[]={};
ArrayList list=y.query(sql, ary);
System.out.println(list);
//request.setAttribute("list", list);兩種方法 方法之1
//方法之2是下面<C:.........用Set呼叫
%>
<c:set var="list" value="<%=list%>"/>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>dao4</title>
    </head>
    <body>
        <h1>dao4</h1>

        <c:forEach var="x" items="${list}"  >
            <c:out value="${x.id}" /> , <c:out value="${x.username}" /> ,
            <c:out value="${x.tel}" /> ,<c:out value="${x.birthday}" /><br>
        </c:forEach> 
    </body>
</html>
